package com.example.makerspace.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.makerspace.domain.ImsingleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ImsingleMapper extends BaseMapper<ImsingleDO> {

    @Select("select * from imsingle where (fromuser =#{fromUser} and touser = #{toUser}) or  (toUser =#{fromUser}  and fromuser=#{toUser})")
    List<ImsingleDO> findByUsername(String fromUser, String toUser);

    @Select("select * from imsingle where touser = #{toUser} and readed = 0")
    List<ImsingleDO> findByToUsername(String toUser);

    @Select("DELETE FROM  imsingle where fromuser = #{fromUser}")
    void deleteByFromUser(String fromUser);


}
